<?php
/********************************************************
** Copyright 2010-2013. Todos los derechos reservados. **
** Desarrollado y Gestionado por:					   **
** Sugey Quintero (Analista)						   **
** José G. De Freitas (Programador)					   **
** Klaudia Uribe (Diseñadora Web)					   **
** Cesar Isturiz (Diseñador Web)					   **
**				S E A  v1.0							   **
*********************************************************/

session_start();
include("conexion2.php");

	if (isset($_SESSION['name']) and isset($_SESSION['tiempo'])) {
        include("Tiempo.php");
		date_default_timezone_set('America/Caracas'); setlocale(LC_TIME, 'spanish');
		$usuario = $_SESSION['name'];
		$fecha = date("Y-m-d H:i:s");
		$auditoria = mysql_query("INSERT INTO auditoria SELECT '$usuario', '$fecha' , 'Registro de profesor liceo' ");

    }else {
		echo "<script>alert('Debe ingresar al sistema primero');</script>";
		echo "<script>document.location.href='index.php';</script>";
	}
include("conexion.php");

if(date(m)>=8){ $anio=date(Y); $anio2=$anio+1; $periodo="$anio - $anio2"; } else{ $anio=date(Y)-1; $anio2=$anio+1; $periodo="$anio - $anio2"; }
$cedula = $_GET['cedula'];
if ($cedula){
	$sql = mysql_query("SELECT * FROM profesor WHERE CI_p='$cedula'");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Profesor</title>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- calendario-->
<link rel="stylesheet" type="text/css" href="src/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="src/css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="src/css/steel/steel.css" />
<script type="text/javascript" src="src/js/jscal2.js"></script>
<script type="text/javascript" src="src/js/lang/es.js"></script>
<!-- fin calendario-->
<!-- botones-->
<link type="text/css" href="js/css/smoothness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />      
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="js/prototype.js" type="text/javascript"></script>
<script language="JavaScript" src="js/ValidarProf.js"></script>
<script type="text/javascript" src="js/rounded-corners.js"></script>
<script type="text/javascript" src="js/form-field-tooltip.js"></script>
<script>
var j$ = jQuery.noConflict();
j$(document).ready(function(){
j$(".button").button();
Validar();
});

j$(function(){
	j$('#menu li a').click(function(event){
		var elem = j$(this).next();
		if(elem.is('ul')){
			event.preventDefault();
			j$('#menu ul:visible').not(elem).slideUp();
			elem.slideToggle();
		}
	});
});

function comprobar_p()
{  
  var url = 'http://127.0.0.1/sistema/sistema_liceo/comprobar_p.php';
  var pars= ('cedula_p=' + document.getElementById('cedula_p').value);
  var myAjax = new Ajax.Updater( 'comprobar_mensaje_p', url, { method: 'get', parameters: pars});
}


//copiar de select a campo texto
oldvalue = "";
function passText(passedvalue) {
  if (passedvalue != "") {
    var totalvalue = oldvalue+passedvalue+", ";
    document.profe.materias.value = totalvalue;
    oldvalue = document.profe.materias.value;
  }
}

<!--
var nav4 = window.Event ? true : false;
function acceptNum(evt){   
var key = nav4 ? evt.which : evt.keyCode;   
return (key <= 13 || (key>= 48 && key <= 57));
}
//-->

function verifyInput(_selList,_textBox,pos) {
	document.getElementById('cedula_p').readOnly = false;
	var SI = eval(_selList+".selectedIndex");
	var SV = eval(_selList+".options[SI].value");
	eval(_textBox+".value = SV");
	var a = eval(_selList+".options.selectedIndex=0");
	if (pos=='0'){
		document.profe.cedula_p.focus();
	}
}
</script>
<!-- fin botones-->
</head>

<body>
<div id="wrap">
<div id="header">
<div id="hora">
<?php include("Hora.php"); ?>
</div>
<div id="topnav">
	<?php include("MenuSuperior.php"); ?>
</div>
</div>
<div id="content">
<div id="left">
<div class="post">
<div class="post_h">

</div>

<div class="postcontent">

<blockquote><h2 align="center">PROFESOR</h2></blockquote>
	<label><font color=#FF0000>(*) Campos obligatorios</font></label>
	<fieldset>
	<legend align=left><b><font size=2>DATOS PERSONALES</font></b></legend>
		<form action="datos_profe.php" method="POST" name='profe' id='profe'>
		<table width=100% cellspacing=3 cellpadding=0 border=0>
			<tr>
				<td width=50%><label style='color: #FF0000'>*</label>C&eacute;dula: </td><td><select name='Nac_p' onchange="verifyInput('document.profe.Nac_p','document.profe.cedula_p','0')"><option></option><option value='V-'>V-</option><option value='E-'>E-</option></select><input name='cedula_p' id='cedula_p' onKeyUp='comprobar_p(this.value)' onKeyPress='return acceptNum(event)' size=8 maxlength=10 readonly tooltipText="Ej: 21253108">&nbsp;&nbsp;<span id='comprobar_mensaje_p'></span></td>
			</tr>
			<tr>
				<td><font color=#FF0000>*</font>Nombres: </td><td><input type='text' name='nombre' id='nombre' size='35' tooltipText="Ej: Juan Pablo"></td>
			</tr>
			<tr>	
				<td><font color=#FF0000>*</font>Apellidos: </td><td><input type='text' name='apellido' id='apellido' size='35' tooltipText="Ej: Perez Lino"></td>
			</tr>
			<tr>
				<td>Lugar de Nac.: </td><td><input type='text' name='lugar_nac' size='35' tooltipText="Ej: La Victoria, Edo Aragua"></td>		
			</tr>
			<tr>	
				<td>Fecha de Nac.: </td><td><select name='f_nac_dia'><option>Dia</option>
					<?php for ($dia=1;$dia<32;$dia++){ echo "<option>$dia</option>"; } ?></select>

					<select name='f_nac_mes'><option>Mes</option>
								<option value='1'>Enero</option>
								<option value='2'>Febrero</option>
								<option value='3'>Marzo</option>
								<option value='4'>Abril</option>
								<option value='5'>Mayo</option>
								<option value='6'>Junio</option>
								<option value='7'>Julio</option>
								<option value='8'>Agosto</option>
								<option value='9'>Septiembre</option>
								<option value='10'>Octubre</option>
								<option value='11'>Noviembre</option>
								<option value='12'>Diciembre</option></select>

					<select name='f_nac_ano'><option>A&ntilde;o</option>";
					<?php $ano=1950; for ($ano;$ano<date(Y);$ano++){ echo "<option>$ano</option>"; } ?></select></td>
			</tr>
			<tr>	
				<td>Sexo: </td><td><input type='radio' name='sexo' value='M'>M <input type='radio' name='sexo' value='F'>F</td>
			</tr>
			<tr>
				<td><font color=#FF0000>*</font>Direcci&oacute;n: </td><td><input type='text' name='direc' id='direc' size='35' tooltipText="Ej: Calle Libertador Sur #15"></td>
			</tr>
			<tr>
				<td>Tlf Casa: </td><td><input type=text name=tlfo_c size=12 maxlength=11 onKeyPress='return acceptNum(event)' tooltipText="Ej: 02443221212"></td>
			</tr>
			<tr>
				<td><font color=#FF0000>*</font>Tlf Movil: </td><td><input type=text name='tlfo_m' id='tlfo_m' size='12' maxlength='11' onKeyPress='return acceptNum(event)' tooltipText="Ej: 04161234567"></td>
			</tr>
		</table>
	</fieldset>

<div class='post'>
<span></span></div>

	<fieldset>
	<legend align=left><b><font size=2>DATOS ACADEMICOS</font></b></legend>
		<table width=100% cellspacing=3 cellpadding=0 border=0>
			<tr>	
				<td>Profesor guia: </td><td><select name='grado'><option value=''>A&ntilde;o</option>
														<option value='1er'>1er A&ntilde;o</option>
														<option value='2do'>2do A&ntilde;o</option>
														<option value='3er'>3er A&ntilde;o</option></select> / 
											<select name='seccion'><option value=''>Secci&oacute;n</option>
												<option>A</option>
												<option>B</option></select></td>
			</tr>
			<tr>	
				<td>A&ntilde;o de Ingreso: </td><td><input type=text name=ano_ing size=4 maxlength=4 onKeyPress='return acceptNum(event)' tooltipText="Ej: 2000"></td>
			<tr>
				<td>Titulo: </td><td><input type=text name=aprobo size=35 tooltipText="Ej: Lic: Educacion Especialidad Matematica"></td>
			</tr>
			<tr>
				<td><font color=#FF0000>*</font>Seleccione las materias a dictar: </td><td><select name='select' id='select' onChange='passText(this.form.select.options[this.form.select.selectedIndex].value);'><option>1er A&ntilde;o</option><?php include('conexion.php'); $septimo=mysql_query('SELECT Cod_m, nombre_m from materia where ano_m="1er"'); while($row=mysql_fetch_array($septimo)) { echo "<option value=$row[0] > $row[1] </option>"; } ?></select><br>
																	<select name='select2' onChange='passText(this.form.select2.options[this.form.select2.selectedIndex].value);'><option>2do A&ntilde;o</option><?php include('conexion.php'); $octavo=mysql_query('SELECT Cod_m, nombre_m from materia where ano_m="2do"'); while($row=mysql_fetch_array($octavo)) { echo "<option value=$row[0] > $row[1] </option>"; } ?></select><br>
																	<select name='select3' onChange='passText(this.form.select3.options[this.form.select3.selectedIndex].value);'><option>3er A&ntilde;o</option><?php include('conexion.php'); $noveno=mysql_query('SELECT Cod_m, nombre_m from materia where ano_m="3er"'); while($row=mysql_fetch_array($noveno)) { echo "<option value=$row[0] > $row[1] </option>"; } ?></select></td>
			</tr>
			<tr>
				<td>C&oacute;digo de las materias seleccionadas: </td><td><input type=text size=35 name='materias' id='materias' readonly=true;></td>
				<input type=hidden name='periodo' value="<?php echo $periodo; ?>">
			</tr>
		</table>
	</fieldset>

<div class="post">
<span></span></div>

<div id=botonera align=center>
	<input class=button type=submit value=Guardar name=submit>
	<input class=button type=submit value=Cancelar onClick=location='index.php'>
</div>

</div>
<div class="post_b">
<span></span></div>
</div>
</form>

</div>

<div class="post">
<div class="post_h">

</div>

<script type="text/javascript">
var tooltipObj = new DHTMLgoodies_formTooltip();
tooltipObj.setTooltipPosition('right');
tooltipObj.setPageBgColor('#EEEEEE');
tooltipObj.setTooltipCornerSize(8);
tooltipObj.initFormFieldTooltip();
</script>

</div>

<?php include("Menu.php"); ?>

<div class="clear"></div>
</div>
<div id="pagebottom"></div>

<div id="footer">
<P>&reg; Derechos Reservados @ CopyRight. 2011-2012</P>
<p>Programadores: Quintero E, Isturiz C, Uribe C, De Freitas J.</p>
</div>
</div>
</body>
</html>
